//
//  ZHFMusicPlayerViewController.m
//  GoTraveling
//
//  Created by dllo on 15/12/28.
//  Copyright © 2015年 开发华佗. All rights reserved.
//

#import "ZHFMusicPlayerViewController.h"

#import "ZHFStartView.h"

#import "ZHFPlayingView.h"

#import "ZHFSongDescriptionView.h"

#import "ZHFAuthorDescription.h"

#import "ZHFListPlayList.h"

#import "ZHFPlayListCell.h"

#import "GSYResources.h"

#import "ZHFRadioViewController.h"

#import "UIView_extra.h"


@interface ZHFMusicPlayerViewController ()<UIScrollViewDelegate,UITableViewDataSource,UITableViewDelegate,authorDesDelegate>

@property(nonatomic, retain)UIScrollView *playerScrollView;
@property (nonatomic,strong) UITableView *playListTableView;
@property (nonatomic,strong) UIView *greenSelectCell;
@property (nonatomic,strong) ZHFStartView *startView;
@property (nonatomic,strong) UIButton *backButton;
@property (nonatomic,strong) UIView *rightView;
@property (nonatomic,strong) UILabel *titleLabel;

@property (nonatomic,strong) ZHFPlayingView *playingView;
@property (nonatomic,strong) ZHFSongDescriptionView *songDescriptionView;
@property (nonatomic,strong) ZHFAuthorDescription *authorDescription;
@property(nonatomic,strong) NSTimer *myTimer;
@property(nonatomic,strong) NSMutableArray *listArray;;
@property(nonatomic,strong) NSMutableArray *authorArray;
@property (nonatomic,strong) ZHFListPlayList *playingModel;
@property(nonatomic,retain)NSMutableDictionary *musicDic;
@property(nonatomic,retain)UIImageView *startImage;

@property(nonatomic, assign)NSInteger indexRow;//记录上一页点击cell的下标


@end

@implementation ZHFMusicPlayerViewController


#pragma mark -

+(instancetype)shareMusicPlayerViewController{
    static ZHFMusicPlayerViewController *shareMusicPlayerVC = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        shareMusicPlayerVC = [[ZHFMusicPlayerViewController alloc]init];
    });
    return shareMusicPlayerVC;
}


#pragma mark - 页面将要消失的时候触发的方法

-(void)viewWillDisappear:(BOOL)animated{
    [self.backButton removeFromSuperview];
    [self.rightView removeFromSuperview];
    [self.titleLabel removeFromSuperview];
    
}


#pragma mark - 页面将要出现的时候触发的方法

-(void)viewWillAppear:(BOOL)animated{
    
#pragma mark  判断是否是从 home页 跳进来的
    if([[[NSUserDefaults standardUserDefaults]objectForKey:@"HomePush"]isEqualToString:@"1"]){
        
        self.listArray = [NSMutableArray array];
        for (NSMutableDictionary *dic in self.musicModel.playList) {
            ZHFListPlayList *listModel = [[ZHFListPlayList alloc]init];
            [listModel setValuesForKeysWithDictionary:dic];
            [self.listArray addObject:listModel];
        }
        
        if (self.musicModel._id != self._id){
            self._id = self.musicModel._id;
            
            [self requestData];
            [self.playListTableView reloadData];
            self.startImage.image = [UIImage imageNamed:@"iconfont-zanting.png"];//播放按钮 暂停图标
            
        }else{
            //如果是同一个id 继续播放
            [self.player resume];
            
            self.startImage.image = [UIImage imageNamed:@"iconfont-zanting.png"];//播放按钮 暂停图标
        }
        
#pragma mark  判断是否是从 电台页 跳进来的
    } else if ([[[NSUserDefaults standardUserDefaults] objectForKey:@"RadioPush"] isEqualToString:@"1"]){
        
        [[NSUserDefaults standardUserDefaults] setObject:@"0" forKey:@"RadioPush"];
        
        //清空播放列表数组
        self.listArray = [NSMutableArray array];
        //给播放列表的数组传值
        for (NSMutableDictionary *dic in self.musicArray) {
            ZHFListPlayList *listModel = [[ZHFListPlayList alloc]init];
            [listModel setValuesForKeysWithDictionary:dic];
            [self.listArray addObject:listModel];
        }
        
        //如果不是同一个id 重新赋值
        if (self.ting_id != self._id){
            self._id = self.ting_id;
            
            [self requestData];
            [self.playListTableView reloadData];
            self.startImage.image = [UIImage imageNamed:@"iconfont-zanting.png"];//播放按钮 暂停图标
            
        }else{
            //如果是同一个id 继续播放
            [self.player resume];
            
            self.startImage.image = [UIImage imageNamed:@"iconfont-zanting.png"];//播放按钮 暂停图标
        }
        
#pragma mark 判断是否是从 搜索 跳转过来的
    }else if ([[[NSUserDefaults standardUserDefaults]objectForKey:@"SearchPush"] isEqualToString:@"1"]){
        
        [[NSUserDefaults standardUserDefaults]setObject:@"0" forKey:@"SearchPush"];
        
        self._id = self.ting_id;
        
        [self requestData];
        [self.playListTableView reloadData];
        self.startImage.image = [UIImage imageNamed:@"iconfont-zanting.png"];//播放按钮 暂停图标
        
#pragma mark 判断是否是从 收藏 跳转过来的
    }else if ([[[NSUserDefaults standardUserDefaults]objectForKey:@"CollectPush"] isEqualToString:@"1"]){
        
        [[NSUserDefaults standardUserDefaults]setObject:@"0" forKey:@"CollectPush"];
        self._id = self.ting_id;
        
        [self requestData];
        [self.playListTableView reloadData];
        self.startImage.image = [UIImage imageNamed:@"iconfont-zanting.png"];//播放按钮 暂停图标
        
#pragma mark 判断是否是从 抽屉 跳转过来的
    }else if([[[NSUserDefaults standardUserDefaults]objectForKey:@"FootPush"]isEqualToString:@"1"]){
        
        [[NSUserDefaults standardUserDefaults]setObject:@"0" forKey:@"FootPush"];
        
    }
    
    
    //创建返回按钮
    self.backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.backButton.frame = CGRectMake(0, 0, self.navigationController.navigationBar.frame.size.height, self.navigationController.navigationBar.frame.size.height);
    self.backButton.backgroundColor = [UIColor whiteColor];
    [self.navigationController.navigationBar addSubview:self.backButton];
    
    [self.backButton setBackgroundImage:[UIImage imageNamed:@"iconfont-fanhui.png"] forState:UIControlStateNormal];
    
    
    //返回按钮方法
    [self.backButton addTarget:self action:@selector(backAction:) forControlEvents:UIControlEventTouchUpInside];
    
    
    //创建一个空View顶替系统LeftBar
    UIView *nilView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 0, 0)];
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:nilView];
    
    //自定义右边View
    self.rightView = [[UIView alloc]initWithFrame:CGRectMake(self.backButton.frame.size.width + 1, 0, self.navigationController.navigationBar.frame.size.width - self.backButton.frame.size.width - 1, self.navigationController.navigationBar.frame.size.height)];
    self.rightView.backgroundColor = [UIColor whiteColor];
    [self.navigationController.navigationBar addSubview:self.rightView];
    
    //创建label(navigationItem.title)来显示每页标题
    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(self.rightView.frame.size.height / 4, self.rightView.frame.size.height / 4, self.navigationController.navigationBar.frame.size.width / 1.5, self.rightView.frame.size.height / 2)];
    [self.rightView addSubview:self.titleLabel];
    
    
    //发送通知
    [[NSNotificationCenter defaultCenter]postNotificationName:@"Play" object:[[NSUserDefaults standardUserDefaults] objectForKey:@"play"]];
    
}


- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    
    //底部音频播放控制器
    self.startView = [[ZHFStartView alloc]initWithFrame:CGRectMake(0, self.view.frame.size.height / 13 * 10, self.view.frame.size.width, self.view.frame.size.height / 13 * 2)];
    [self.view addSubview:self.startView];
    
    //创建底层Scrollview
    self.playerScrollView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, -20 * ADAPT_HEIGHT, self.view.frame.size.width, self.view.frame.size.height / 13 * 11 - 44)];
    self.playerScrollView.contentSize = CGSizeMake(self.view.frame.size.width * 4, self.view.frame.size.height / 13 * 11 - 44);
    self.playerScrollView.contentOffset = CGPointMake(self.view.frame.size.width, 0);
    
    self.playerScrollView.pagingEnabled = YES;
    self.playerScrollView.showsHorizontalScrollIndicator = YES;
    self.playerScrollView.bounces = NO;
    self.playerScrollView.delegate = self;
    [self.view addSubview:self.playerScrollView];
    
    //创建播放列表tableView
    self.playListTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 20 + self.rightView.frame.size.height, self.view.frame.size.width, self.playerScrollView.frame.size.height - 20 - self.rightView.frame.size.height) style:UITableViewStylePlain];
    self.playListTableView.delegate = self;
    self.playListTableView.dataSource = self;
    
    [self.playerScrollView addSubview:self.playListTableView];
    [self.playListTableView registerClass:[ZHFPlayListCell class] forCellReuseIdentifier:@"cell"];
    [self.playListTableView reloadData];
    
    self.greenSelectCell = [[UIView alloc]init];
    
    
    //创建正在播放PlayingView
    self.playingView = [[ZHFPlayingView alloc]initWithFrame:CGRectMake(self.view.frame.size.width, self.rightView.frame.size.height - 40 * ADAPT_HEIGHT, self.view.frame.size.width, self.playerScrollView.frame.size.height - 20 - self.rightView.frame.size.height)];
    [self.playerScrollView addSubview:self.playingView];
    
    
    //创建音频简介SongDescriptionView
    self.songDescriptionView = [[ZHFSongDescriptionView alloc]initWithFrame:CGRectMake(self.view.frame.size.width * 2, 20 + self.rightView.frame.size.height, self.view.frame.size.width, self.playerScrollView.frame.size.height - 20 - self.rightView.frame.size.height)];
    [self.playerScrollView addSubview:self.songDescriptionView];
    
    
    //创建主播简介AuthorDescription
    self.authorDescription = [[ZHFAuthorDescription alloc]initWithFrame:CGRectMake(self.view.frame.size.width * 3, 20 + self.rightView.frame.size.height, self.view.frame.size.width, self.playerScrollView.frame.size.height - 20 - self.rightView.frame.size.height)];
    [self.playerScrollView addSubview:self.authorDescription];
    //签协议
    self.authorDescription.authorDeleage = self;
    //主播界面 全部电台按钮
    [self.authorDescription.checkAllRadio addTarget:self action:@selector(checkAllRadioAction:) forControlEvents:UIControlEventTouchUpInside];
    
    
    //列表绿色小滑条
    self.greenSelectCell.frame = CGRectMake(0, 0, 10, self.playListTableView.frame.size.height / 7);
    self.greenSelectCell.backgroundColor = [UIColor colorWithRed:155 / 255.0 green:198/255.0 blue:121 / 255.0 alpha:1.0];
    [self.playListTableView addSubview:self.greenSelectCell];
    
    [self setAutomaticallyAdjustsScrollViewInsets:NO];
    
    
    
    
    //播放
    [self.startView.startButton addTarget:self action:@selector(playAction:) forControlEvents:UIControlEventTouchUpInside];
    
    
    //上一曲按钮
    [self.startView.nextMusicButton addTarget:self action:@selector(nextMusicAction:) forControlEvents:UIControlEventTouchUpInside];
    
    //下一曲按钮
    [self.startView.lastMusicButton addTarget:self action:@selector(lastMusicAction:) forControlEvents:UIControlEventTouchUpInside];
    
    //playlist  播放列表
    //playing   正在播放
    //SongDescription  歌曲简介
    //AnchorDescription  主播简介
    
    
#pragma mark  播放器对象
    self.player = [[STKAudioPlayer alloc]initWithOptions:(STKAudioPlayerOptions){ .flushQueueOnSeek = YES, .enableVolumeMixer = YES, .equalizerBandFrequencies = {50, 100, 200, 400, 800, 1600, 2600, 16000} } ];
    
    //定时器
    [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timeAction:) userInfo:nil repeats:YES];
    
    [self.playingView.musicSlider addTarget:self action:@selector(slderAction) forControlEvents:UIControlEventValueChanged];
    
    
#pragma mark 传值
    //初始化
    self.listArray = [NSMutableArray array];
    
}

#pragma mark - 协议方法(其他作品)
-(void)sendAuthorDescriptionTingid:(NSString *)tingid{
    
    self._id = tingid;
    [self requestData];
    self.startImage.image = [UIImage imageNamed:@"iconfont-zanting.png"];//暂停图标
    
    //点击其他作品的item时候  跳到播放器页面
    [self.playerScrollView setContentOffset:CGPointMake(self.view.frame.size.width, 0) animated:YES];
    
    //让从Home push进来的状态还原
    [[NSUserDefaults standardUserDefaults]setObject:@"0" forKey:@"HomePush"];
    
    //给播放器列表传值
    self.listArray = [NSMutableArray array];
    for (NSMutableDictionary *dic in self.authorArray) {
        ZHFListPlayList *listModel = [[ZHFListPlayList alloc]init];
        [listModel setValuesForKeysWithDictionary:dic];
        [self.listArray addObject:listModel];
        
    }
    
    [self.playListTableView reloadData];
    
    
}




#pragma mark - 请求数据
-(void)requestData{
    
    NSString *urlStr = @"http://api2.pianke.me/ting/info";
    NSString *body = [NSString stringWithFormat: @"auth=&client=1&deviceid=9573086A-0F03-4529-818F-432267320CE8&tingid=%@&version=3.0.6",self._id];
    
    NSLog(@"%@",self._id);
    
    [GSYResources postUrl:urlStr body:body result:HXJSON requestStyle:HXRequestString headerFile:nil success:^(id result) {
        
        
        NSMutableDictionary *bigDic = [result objectForKey:@"data"];
        ZHFListPlayList *playModel = [[ZHFListPlayList alloc]init];
        [playModel setValuesForKeysWithDictionary:[bigDic objectForKey:@"playInfo"]];
        self.authorArray = [NSMutableArray array];
        self.authorArray = [bigDic objectForKey:@"moreting"];
        
        //抽屉 播放栏通知传值
        ZHFListPlayList *musicDataModel = [[ZHFListPlayList alloc]init];
        [musicDataModel setValuesForKeysWithDictionary:[bigDic objectForKey:@"playInfo"]];
        [[NSNotificationCenter defaultCenter]postNotificationName:@"setData" object:musicDataModel];
        
        //播放
        NSString *url = [[bigDic objectForKey:@"playInfo"]objectForKey:@"musicUrl"];
        [self.player playURL:[NSURL URLWithString:url]];
        
        //authorDescription 主播界面 传值
        self.authorDescription.autorDic = bigDic;
        
        //playingView   播放器界面 传值
        self.playingView.likeNum.text = [NSString stringWithFormat:@"%@",[bigDic objectForKey:@"like"]];
        self.playingView.commentNum.text = [NSString stringWithFormat:@"%@",[bigDic objectForKey:@"comment"]];
        self.playingView.playModel = playModel;
        
        //songDescriptionView  传值
        [self.songDescriptionView setWebUrl:playModel.webview_url];
        
        //播放器标题
        self.titleLabel.text = self.playingView.musicTitle.text;
        
    } failure:^(NSError *error) {
        
        
    }];
    
}


#pragma mark - 所有电台按钮
- (void)checkAllRadioAction:(UIButton * )checkAllRadio{
    ZHFRadioViewController *radioVC = [[ZHFRadioViewController alloc]init];
    [self.navigationController pushViewController:radioVC animated:YES];
    
}

#pragma mark - 进度条方法
-(void)slderAction{
    
    //改变播放进度
    [self.player seekToTime:self.playingView.musicSlider.value];
}




#pragma mark - 计时器方法
-(void)timeAction:(NSTimer *)timer{
    
    self.playingView.musicSlider.maximumValue = self.player.duration;//duration 音乐总时长
    self.playingView.musicSlider.value = self.player.progress; //当前播放时长
    
    NSInteger zongTime = self.player.duration;
    
    NSInteger min = (NSInteger)(zongTime - self.player.progress)/60;
    NSInteger sec = (NSInteger)(zongTime - self.player.progress)%60;
    //显示时间
    
    self.playingView.remainTime.text = [NSString stringWithFormat:@"%02ld:%02ld",min,sec];
    if ((NSInteger)self.playingView.musicSlider.value + 1 == (NSInteger)self.playingView.musicSlider.maximumValue) {
        
        [self nextMusicAction:nil];
    }
    
}


#pragma mark - 播放
- (void)playAction:(UIButton *)playAction{
    
    if (self.player.state == STKAudioPlayerStatePaused) {
        
        self.startImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.startView.startButton.frame.size.width / 3 * 2 - 2, self.startView.startButton.frame.size.height / 3 * 2 - 2)];
        self.startImage.backgroundColor = [UIColor whiteColor];
        self.startImage.center = CGPointMake(self.startView.startButton.center.x, self.startView.startButton.center.y);
        self.startImage.image = [UIImage imageNamed:@"iconfont-zanting.png"];//暂停图标
        [self.startView addSubview:self.startImage];
        
        // 通知 抽屉 变为暂停
        [[NSNotificationCenter defaultCenter] postNotificationName:@"stop" object:nil];
        NSLog(@"暂停");
        [self.player resume];//继续
        
    } else if (self.player.state == STKAudioPlayerStatePlaying) {
        
        self.startImage = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.startView.startButton.frame.size.width / 3 * 2 - 2, self.startView.startButton.frame.size.height / 3 * 2 - 2)];
        self.startImage.backgroundColor = [UIColor whiteColor];
        self.startImage.center = CGPointMake(self.startView.startButton.center.x , self.startView.startButton.center.y);
        self.startImage.image = [UIImage imageNamed:@"iconfont-bofang-2.png"];//播放图标
        [self.startView addSubview:self.startImage];
        
        // 通知 抽屉 变为播放
        [[NSNotificationCenter defaultCenter] postNotificationName:@"play" object:nil];
        
        NSLog(@"播放");
        [self.player pause];//暂停
        
    } else {
        
        [self requestData];
        self.startImage.image = [UIImage imageNamed:@"iconfont-zanting.png"];//暂停图标
    }
}


#pragma mark - 上一曲
- (void)lastMusicAction:(UIButton *)lastMusicAction{
    
    if (self.indexRow != 0) {
        self.indexRow = (self.indexRow - 1);
        
        ZHFListPlayList *listModel = [self.listArray objectAtIndex:self.indexRow];
        self._id = listModel.tingid;
        [self requestData];
        self.startImage.image = [UIImage imageNamed:@"iconfont-zanting.png"];//暂停图标
        
    } else {
        
        self.indexRow = self.listArray.count - 1;
        ZHFListPlayList *listModel = [self.listArray objectAtIndex:self.indexRow];
        self._id = listModel.tingid;
        [self requestData];
        self.startImage.image = [UIImage imageNamed:@"iconfont-zanting.png"];//暂停图标
        
    }
    
    //左侧小竖条
    self.greenSelectCell.origin = CGPointMake(0, self.playListTableView.frame.size.height / 7 * self.indexRow);
    
    
    NSLog(@"上一曲");
}





#pragma mark - 下一曲
- (void)nextMusicAction:(UIButton *)nextMusicAction{
    
    //+1后对总数取余是为了防止点击多次,数组越界
    self.indexRow = (self.indexRow + 1)%self.listArray.count;
    
    NSLog(@"indexRow = %ld", self.indexRow);
    //如果歌曲总数大于当前播放的音乐下标
    if (self.indexRow < self.listArray.count) {
        
        ZHFListPlayList *listModel = [self.listArray objectAtIndex:self.indexRow];
        self._id = listModel.tingid;
        [self requestData];
        self.startImage.image = [UIImage imageNamed:@"iconfont-zanting.png"];//暂停图标
        
    } else {
        
        //如果总数小于当前下标,直接播放取余数后的.也就是从第一首歌开始播放,用户体验是循环播放了
        [self requestData];
        self.startImage.image = [UIImage imageNamed:@"iconfont-zanting.png"];//暂停图标
        
    }
    
    //左侧小竖条
    self.greenSelectCell.origin = CGPointMake(0, self.playListTableView.frame.size.height / 7 * self.indexRow);
    
    NSLog(@"下一曲");
}


#pragma mark - 返回按钮方法

- (void)backAction:(UIButton *)backAction{
    //    AppDelegate *pushToVC = (AppDelegate *)[[UIApplication sharedApplication]delegate];
    [self.navigationController popViewControllerAnimated:YES];
    
}


#pragma mark - cell数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return self.listArray.count;
}



#pragma mark - cell高
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return self.playListTableView.frame.size.height / 7;
}

#pragma mark -  cell赋值
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString  *cellIdentifier = @"cell";
    ZHFPlayListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell == nil) {
        cell = [[ZHFPlayListCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    
    cell.playListModel =  [self.listArray objectAtIndex:indexPath.row];
    
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
    
}


#pragma mark - 触摸cell时触发方法
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    self.indexRow = indexPath.row;
    self.greenSelectCell.origin = CGPointMake(0, self.playListTableView.frame.size.height / 7 * self.indexRow);
    
    
    ZHFPlayListCell *listCell = (ZHFPlayListCell *)[tableView cellForRowAtIndexPath:indexPath];
    
    
    self._id = listCell.playListModel.tingid;
    [self requestData];
}




#pragma mark - 减速停止时触发(滑动结束)
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
    NSLog(@"减速停止");
    
    if (scrollView.contentOffset.x == 0) {
        self.startView.pageOne.backgroundColor = [UIColor colorWithRed:155 / 255.0 green:198/255.0 blue:121 / 255.0 alpha:1.0];
        self.startView.pageTwo.backgroundColor = [UIColor grayColor];
        self.startView.pageThree.backgroundColor = [UIColor grayColor];
        self.startView.pageFour.backgroundColor = [UIColor grayColor];
    }else if(scrollView.contentOffset.x == self.view.frame.size.width){
        self.startView.pageTwo.backgroundColor = [UIColor colorWithRed:155 / 255.0 green:198/255.0 blue:121 / 255.0 alpha:1.0];
        self.startView.pageOne.backgroundColor = [UIColor grayColor];
        self.startView.pageThree.backgroundColor = [UIColor grayColor];
        self.startView.pageFour.backgroundColor = [UIColor grayColor];
    }else if(scrollView.contentOffset.x == self.view.frame.size.width * 2){
        self.startView.pageThree.backgroundColor = [UIColor colorWithRed:155 / 255.0 green:198/255.0 blue:121 / 255.0 alpha:1.0];
        self.startView.pageTwo.backgroundColor = [UIColor grayColor];
        self.startView.pageOne.backgroundColor = [UIColor grayColor];
        self.startView.pageFour.backgroundColor = [UIColor grayColor];
    }else{
        self.startView.pageFour.backgroundColor = [UIColor colorWithRed:155 / 255.0 green:198/255.0 blue:121 / 255.0 alpha:1.0];
        self.startView.pageTwo.backgroundColor = [UIColor grayColor];
        self.startView.pageThree.backgroundColor = [UIColor grayColor];
        self.startView.pageOne.backgroundColor = [UIColor grayColor];
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
